package figure8.GUI;

import java.awt.Desktop;
import java.awt.Toolkit;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.net.URI;

import javax.swing.Box;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
 
public class ContactWindow extends JFrame {
	public ContactWindow(MainWindow window)
	{
		this.setLocation(window.getFrame().getX() + 80, window.getFrame().getY() + 120);
		this.setIconImage(Toolkit.getDefaultToolkit().getImage("src/figure8/GUI/Fig8-small.png"));
		this.setAlwaysOnTop(true);
		JLabel line1 = new JLabel("Welcome to Figure8. This software is open source.");
		JLabel line2 = new JLabel("Please feel free to access our website is available at:");
		JLabel line3 = new JLabel("<html><a href=\"www.figure8.etherclear.org\">Figure8 </a></html>");
		line3.addMouseListener(new MouseAdapter() {
			@Override
			public void mousePressed(MouseEvent e) {
				Desktop desktop = Desktop.getDesktop();
				try {
					URI uri = new URI("http://www.figure8.etherclear.org");
					desktop.browse(uri);
				} catch (Exception e1) {
					e1.printStackTrace();
				}
			}
		});
		JLabel line4 = new JLabel("If you also wish to reach us via email, then feel free:");
		JLabel line5 = new JLabel("<html><a href=\"mailto:mobius.figure8@gmail.com\">Email</a></html>");
		line5.addMouseListener(new MouseAdapter() {
			@Override
			public void mousePressed(MouseEvent e) {
				Desktop desktop = Desktop.getDesktop();
				try {
					URI uri = new URI("mailto:mobius.figure8@gmail.com");
					desktop.browse(uri);
				} catch (Exception e1) {
					e1.printStackTrace();
				}
			}
		});
		Box column = Box.createVerticalBox();
		Box row1 = Box.createHorizontalBox();
		Box row2 = Box.createHorizontalBox();
		Box row3 = Box.createHorizontalBox();
		Box row4 = Box.createHorizontalBox();
		Box row5 = Box.createHorizontalBox();
		row1.add(line1);
		row2.add(line2);
		row3.add(line3);
		row4.add(line4);
		row5.add(line5);
		column.add(row1);
		column.add(row2);
		column.add(row3);
		column.add(row4);
		column.add(row5);
		JPanel panel = new JPanel();
		panel.add(column);
		this.add(panel);
		this.setTitle("Contact Us");
		this.pack();
		this.setVisible(true);
	}

}